<template>
  <div class="list">
    <div class="title">
      <p>院线排片</p>
    </div>
    <div v-for="(item, index) in arrangementList" :key="index" class="film">
      <div class="name">《{{ item.name }}》</div>
      <div class="id">场次ID：{{ item.id }}</div>
      <div class="type">类型：{{ item.type }}</div>
      <div class="price">票价：{{ item.price }}元</div>
      <div class="time1">
        <div>开场：{{ item.startTime }}</div>
        <div>散场：{{ item.endTime }}</div>
      </div>
      <div class="time2">
        <div>创建时间：{{ item.createTime }}</div>
        <div>更新时间：{{ item.updateTime }}</div>
      </div>
    </div>
  </div>
</template>

<script>
import { ArrangementList } from "@/api/manager";
export default {
  data() {
    return {
      arrangementList: {},
    };
  },
  mounted() {
    this.getArrangementList();
  },
  methods: {
    // 获取电影列表
    getArrangementList() {
      ArrangementList().then((res) => {
        res.msg = "arrangementList";
        for (var i = 0; i < res.data.length; i++) {
          res.data[i].startTime = this.formatDate(res.data[i].startTime);
          res.data[i].endTime = this.formatDate(res.data[i].endTime);
          res.data[i].createTime = this.formatDate(res.data[i].createTime);
          res.data[i].updateTime = this.formatDate(res.data[i].updateTime);
        }
        console.log(res);
        this.arrangementList = res.data;
      });
    },
    // 日期格式化
    formatDate(dateint) {
      var date = new Date(parseInt(dateint));
      var str = date.getFullYear() + "-";
      if (date.getMonth() < 10) {
        str += "0";
      }
      str += date.getMonth() + 1 + "-";
      if (date.getDate() < 10) {
        str += "0";
      }
      str += date.getDate() + " ";
      if (date.getHours() < 10) {
        str += "0";
      }
      str += date.getHours() + ":";
      if (date.getMinutes() < 10) {
        str += "0";
      }
      str += date.getMinutes() + ":";
      if (date.getSeconds() < 10) {
        str += "0";
      }
      str += date.getSeconds();
      return str;
    },
  },
};
</script>

<style lang='scss' scoped>
.list {
  width: 1100px;
  height: 850px;
  background-color: #fff;
  margin: auto;
  position: relative;
  top: 25px;
  overflow-x: hidden;
  overflow-y: auto;
  .title {
    height: 35px;
    padding-left: 20px;
    background-color: aqua;
    border: 5px outset aqua;
    p {
      font-size: 25px;
      font-weight: bold;
    }
  }
  .film {
    width: 1100px;
    height: 130px;
    float: left;
    border-bottom: 1px solid #000;
    padding: 5px;
    img {
      width: 100px;
      height: 130px;
      float: left;
    }
    .name {
      padding: 45px 0;
      float: left;
      font-size: 25px;
      margin-right: 25px;
    }
    .id{
      padding: 45px 0;
      float: left;
      font-size: 20px;
      margin-right: 30px;
    }
    .type {
      padding: 50px 0;
      float: left;
      margin-right: 30px;
    }
    .price {
      padding: 50px 0;
      float: left;
      margin-right: 30px;
    }
    .time1 {
      float: left;
      div {
        padding: 23px 0;
        margin-right: 30px;
      }
    }
    .time2{
      div {
        padding: 23px 0;
        margin-right: 30px;
      }

    }
  }
}
</style>